package com.deyuanyun.pic.ctrl.controller.vo.exinsp;

import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.ctrl.controller.vo.DefaultCommand;
import com.deyuanyun.pic.ctrl.domain.ExinspAntiSurge;
import com.deyuanyun.pic.ctrl.enumeration.AbnormalEnum;
import com.deyuanyun.pic.ctrl.enumeration.AppearanceCheckEnum;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.util.ArrayList;
import java.util.List;

/**
 * 防浪涌保护器检测记录表
 */
public class ExinspAntiSurgeVO extends ExinspBaseVO<ExinspAntiSurge> {

    // 管道名称
    private String pipeLineName;
    // 设备编号(自定义编号)
    private String customNumber;
    // 测试桩编号
    private String testStationNum;
    // 所属场站阀室
    private String pipeValveroomNanme;
    // 位置描述
    private String locationDescription;
    // 站内侧管/地电位（mV）
    public Long nonProtectivePotential;
    // 站外侧管/地电位（mV）
    public Long protectivePotential;
    // 外观检查
    private String appearanceCheck;
    // 异常记录
    private String faultRecord;
    // 是否有异常(YES、NO)
    private String abnormal;
    // 处理措施
    private String treatmentMeasures;
    // 检测日期
    private String detectiongDete;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getCustomNumber() {
        return customNumber;
    }

    public void setCustomNumber(String customNumber) {
        this.customNumber = customNumber;
    }

    public String getTestStationNum() {
        return testStationNum;
    }

    public void setTestStationNum(String testStationNum) {
        this.testStationNum = testStationNum;
    }

    public String getPipeValveroomNanme() {
        return pipeValveroomNanme;
    }

    public void setPipeValveroomNanme(String pipeValveroomNanme) {
        this.pipeValveroomNanme = pipeValveroomNanme;
    }

    public String getLocationDescription() {
        return locationDescription;
    }

    public void setLocationDescription(String locationDescription) {
        this.locationDescription = locationDescription;
    }

    public Long getNonProtectivePotential() {
        return nonProtectivePotential;
    }

    public void setNonProtectivePotential(Long nonProtectivePotential) {
        this.nonProtectivePotential = nonProtectivePotential;
    }

    public Long getProtectivePotential() {
        return protectivePotential;
    }

    public void setProtectivePotential(Long protectivePotential) {
        this.protectivePotential = protectivePotential;
    }

    public String getAppearanceCheck() {
        return appearanceCheck;
    }

    public void setAppearanceCheck(String appearanceCheck) {
        this.appearanceCheck = appearanceCheck;
    }

    public String getFaultRecord() {
        return faultRecord;
    }

    public void setFaultRecord(String faultRecord) {
        this.faultRecord = faultRecord;
    }

    public String getAbnormal() {
        return abnormal;
    }

    public void setAbnormal(String abnormal) {
        this.abnormal = abnormal;
    }

    public String getTreatmentMeasures() {
        return treatmentMeasures;
    }

    public void setTreatmentMeasures(String treatmentMeasures) {
        this.treatmentMeasures = treatmentMeasures;
    }

    public String getDetectiongDete() {
        return detectiongDete;
    }

    public void setDetectiongDete(String detectiongDete) {
        this.detectiongDete = detectiongDete;
    }

    public void fromDomain(ExinspAntiSurge domain) {

        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 设备编号(自定义编号)
        this.customNumber = domain.getCustomNumber();
        // 测试桩编号
        this.testStationNum = domain.getTestStationId();
        // 所属场站阀室
        this.pipeValveroomNanme = PipeLineUtil.getValveRoomName(domain.getPipeValveroomId());
        // 位置描述
        this.locationDescription = domain.getLocationDescription();
        // 站内侧管/地电位（mV）
        this.nonProtectivePotential = domain.getNonProtectivePotential();
        // 站外侧管/地电位（mV）
        this.protectivePotential = domain.getProtectivePotential();
        // 外观检查
        this.appearanceCheck = AppearanceCheckEnum.getLabel(domain.getAppearanceCheck());
        // 异常记录
        this.faultRecord = domain.getFaultRecord();
        // 是否有异常(YES、NO)
        this.abnormal = AbnormalEnum.getLabel(domain.getAbnormal());
        // 处理措施
        this.treatmentMeasures = domain.getUpdateRemark();;
        // 检测日期
        this.detectiongDete = DateFormat.format(domain.getDetectiongDete());

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    public Page<ExinspAntiSurgeVO> fromDomainList(Page<ExinspAntiSurge> domainList) {

        Page<ExinspAntiSurgeVO> list = new Page<ExinspAntiSurgeVO>();
        for (ExinspAntiSurge exinspAntiSurge : domainList) {
            ExinspAntiSurgeVO exinspAntiSurgeVO = new ExinspAntiSurgeVO();
            exinspAntiSurgeVO.fromDomain(exinspAntiSurge);
            list.add(exinspAntiSurgeVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}